#!/bin/bash
if [ $(whoami) != "root" ]
then
    echo "Will Run as ROOT"
    sudo $0
    exit 0
fi
date=$(date +%Y%m%d)
hosts=/etc/hosts
out_file="${hosts}_${date}"
wget https://raw.githubusercontent.com/racaljk/hosts/master/hosts -O ${out_file}
echo "127.0.0.1 $(hostname)" >> ${out_file}
echo "192.168.0.1 pc.baidu.com" >> ${out_file}
echo "192.168.0.1 cu.baidu.com" >> ${out_file}
echo "192.168.0.1 up.baidu.com" >> ${out_file}
rm -f ${hosts}
ln -s ${out_file} ${hosts}
